package edu.guet.cn.blogbasics.common;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @Auther: hejianding
 * @Date: 2021/4/8 14:23
 * @Version: 1.0
 */
public class ResultVO implements Serializable {
    private static final long serialVersionUID = -5359028332240046810L;

    /**
     * description: 返回响应信息
     * @param respCode
     * @param success
     * @return java.util.Map<java.lang.String,java.lang.Object>
     */
    public static Map<String, Object> result(ResultEnum respCode, Boolean success) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("code", respCode.getCode());
        map.put("message", respCode.getMessage());
        map.put("data", null);
        map.put("success",success);
        return map;
    }

    /**
     * description: 返回响应信息及Token
     *
     * @param respCode
     * @param Token
     * @param success
     * @return java.util.Map<java.lang.String,java.lang.Object>
     */
    public final static Map<String, Object> result(ResultEnum respCode, String Token, Boolean success) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("Token",Token);
        map.put("code", respCode.getCode());
        map.put("message", respCode.getMessage());
        map.put("data", null);
        map.put("success",success);
        return map;
    }

    public final static Map<String, Object> result(ResultEnum respCode, String Token, Boolean success,String userName) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("Token",Token);
        map.put("code", respCode.getCode());
        map.put("message", respCode.getMessage());
        map.put("data", null);
        map.put("success",success);
        map.put("username", userName);
        return map;
    }

}
